<?php

/** Report prg file (sms) 
 *  
 *  Dynamically created by ycube plus RAD
 *  
 *  USE THIS FILE TO PERSONALIZE A PROGRAM SIDE OF YOUR REPORT
 *  ==========================================================
 */  

// ATTENTION: CANCEL THIS BLOCK TO EDIT A FILE 
/*
$T = new Y_Template( $file_tpl ); 
// Superior Variables
$T->Set( 'sup_nro_pedido', '11');
$T->Set( 'sup_fecha', '2008-08-20');
$T->Set( 'sup_busc_cli', '');
$T->Set( 'sup_cliente', '1');
$T->Set( 'sup_nom_cli', 'Ferreteria el Sol');
$T->Set( 'sup_pedido_gen', 'false');
$T->Set( 'sup_cambiar_oper', '');
$T->Set( 'sup_det', '');
$T->Set( 'sup_estado', 'Pendiente');
$T->Set( 'sup_imprimir', '');
$T->Set( 'sup___lock', 'true');*/
// ------------------------------------------

// THIS IS YOUR FIRST QUERY:
//$query0 = "SELECT CONCAT("#",cod_prod," ",cantid) AS RESUMEN FROM pedido_det where nro_pedido ='11'";

$T->Set( 'time', daytime() );
$T->Set( 'user', $Global['username'] );

$firstRow=true;
$Q0 = $DB;
$Q0->Query( $query0 );

// Starting a HTML
$T->Show('general_header');			// Principal Header
$T->Show('start_query0');			// Start a Table 
$T->Show('header0');				// Show Header

//Define a  variable
$endConsult = false;
//Define a Total Variables

//Define a Subtotal Variables

$concat = '';

//Define a Old Values Variables
$old['RESUMEN'] = '';

// Making a rows of consult
while( $Q0->NextRecord() ){

    // Define a elements
    $el['RESUMEN'] = $Q0->Record['RESUMEN'];

    // Preparing a template variables
    $T->Set('query0_RESUMEN', $el['RESUMEN']);
    
    $concat = $concat .' '. $el['RESUMEN'];
    
    $T->Set('concat',$concat); 
    
    // Calculating a total

    // Calculating a subtotal

    $T->Show('query0_data_row');
    // Show Subtotal
    if( true ){
        $T->Show('query0_subtotal_row');
        //Reset a Subtotal Variables
    }
    
    //Actualize Old Values Variables
    $old['RESUMEN'] = $el['RESUMEN'];
    $firstRow=false;
 
}

$endConsult = true;
if( true ){
    $T->Show('query0_subtotal_row');
   
}
// Show total
if( true ){
    $T->Show('query0_total_row');
}
$T->Show('end_query0');				// Ends a Table 

?>
